//所有的api都在这个文件管理
import requests from "./request";
import requestsMock from "./requestMock";
//左侧导航栏请求接口地址  /api/product/getBaseCategoryList  GET请求 无参数

export const reqCategoryList = () => {
  return requests({
    url: '/product/getBaseCategoryList',
    method: 'get'
  })
}

export const reqGetBannerList = () => {
  return requestsMock({
    url: '/banner',
    method: 'get'
  })
}

export const reqFloorList = () => {
  return requestsMock({
    url: '/floor',
    method: 'get'
  })
}

export const reqGetSearchInfo = (params) => {
  return requests({
    url: '/list',
    method: 'post',
    data: params
  })
}

export const reqGoodsInfo = (skuId) => {
  return requests({
    url: `/item/${skuId}`,
    method: 'get',
  })
}

export const reqAddOrUpdateShopCar = (skuId, skuNum) => {
  return requests({
    url: `/cart/addToCart/${skuId}/${skuNum}`,
    method: 'post',
  })
}

export const reqShopCart = () => {
  return requests({
    url: `/cart/cartList`,
    method: 'get',
  })
}

export const reqDeleteCartById = (skuId) => {
  return requests({
    url: `/cart/deleteCart/${skuId}`,
    method: 'delete',
  })
}

export const reqUpdateCheckedById = (skuId, isChecked) => {
  return requests({
    url: `/cart/checkCart/${skuId}/${isChecked}`,
    method: 'get',
  })
}

export const reqGetCode = (phone) => {
  return requests({
    url: `/user/passport/sendCode/${phone}`,
    method: 'get',
  })
}

///api/user/passport/register
export const reqUserRegister = (data) => {
  return requests({
    url: `/user/passport/register`,
    data,
    method: 'POST',
  })
}

///api/user/passport/login    post       phone,password  
export const reqUserLogin = (data) => {
  return requests({
    url: `/user/passport/login`,
    data,
    method: 'POST',
  })
}

export const reqUserInfo = () => {
  return requests({
    url: `/user/passport/auth/getUserInfo`,
    method: 'get',
  })
}

export const reqLoginOut = () => {
  return requests({
    url: `/user/passport/logout`,
    method: 'get',
  })
}

export const reqAddressInfo = () => {
  return requests({
    url: `/user/userAddress/auth/findUserAddressList`,
    method: 'get',
  })
}

export const reqOrderInfo = () => {
  return requests({
    url: `/order/auth/trade`,
    method: 'get',
  })
}

export const reqSubmitOrder = (tradeNo, data) => {
  return requests({
    url: `/order/auth/submitOrder?tradeNo=${tradeNo}`,
    data,
    method: 'post',
  })
}